namespace SmartSoft.Controls
{
    using SmartSoft;
    using SmartSoft.Controls.ChildGridControls;
    using SmartSoft.Properties;
    using System;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Windows.Forms;

    public class FormOpenningLister : FormControl
    {
        private ToolStripButton btnAdd;
        private ToolStripButton btnClose;
        private ToolStripButton btnDelete;
        private ToolStripButton btnDetail;
        private ToolStripButton btnEdit;
        private ToolStripButton btnFind;
        private ToolStripButton btnPreview;
        private ToolStripButton btnPrint;
        private ToolStripButton btnRefresh;
        private ToolStripButton btnSum;
        private IContainer components;
        private GridControl grdBrowser;
        private bool ib_CheckDetailMost;
        private object[][] is_LocalColNames;
        private FormOpenningEditor oFormEditor;
        private GridControl oGridBrowser;
        private FormOpenningLister oLocalChildForm;
        private FormOpenningLister oLocalParentForm;
        private DataRow oLocalParentRow;
        private DataTable oLocalTable;
        private object oUserDefined1;
        private object oUserDefined2;
        private object oUserDefined3;
        private ToolStripSeparator tbrSep01;
        private ToolStripSeparator tbrSep02;
        private ToolStripSeparator tbrSep03;
        private ToolStripSeparator tbrSep04;
        private ToolStripSeparator tbrSep05;
        private ToolStripSeparator tbrSep06;
        private ToolStripSeparator tbrSep07;
        private ToolStrip Toolbars;
        private TbarSearch txtSearch;

        public FormOpenningLister()
        {
            this.ib_CheckDetailMost = true;
            this.InitializeComponent();
            this.DataGridBrowser = this.grdBrowser;
            this.DataGridBrowser.AutoGenerateColumns = false;
            this.OnGenerateColumns();
            //this.OnRefresh();
        }

        public FormOpenningLister(bool pb_CheckDetailMost)
        {
            this.ib_CheckDetailMost = true;
            this.InitializeComponent();
            this.DataGridBrowser = this.grdBrowser;
            this.DataGridBrowser.AutoGenerateColumns = false;
            this.CheckDetailMost = pb_CheckDetailMost;
            if (!this.CheckDetailMost)
            {
                this.OnGenerateColumns();
                //this.OnRefresh();
            }
        }

        public FormOpenningLister(bool pb_CheckDetailMost, bool pb_WithoutParent)
        {
            this.ib_CheckDetailMost = true;
            this.InitializeComponent();
            this.DataGridBrowser = this.grdBrowser;
            this.DataGridBrowser.AutoGenerateColumns = false;
            this.CheckDetailMost = pb_CheckDetailMost;
            if (!this.CheckDetailMost || pb_WithoutParent)
            {
                this.OnGenerateColumns();
                //this.OnRefresh();
            }
        }

        public FormOpenningLister(bool pb_CheckDetailMost, object poUserDefined1, object poUserDefined2, object poUserDefined3)
        {
            this.ib_CheckDetailMost = true;
            this.InitializeComponent();
            this.DataGridBrowser = this.grdBrowser;
            this.DataGridBrowser.AutoGenerateColumns = false;
            this.CheckDetailMost = pb_CheckDetailMost;
            this.UserDefined1 = poUserDefined1;
            this.UserDefined2 = poUserDefined2;
            this.UserDefined3 = poUserDefined3;
            if (!this.CheckDetailMost)
            {
                this.OnGenerateColumns();
                this.OnRefresh();
            }
        }

        public FormOpenningLister(bool pb_CheckDetailMost, bool pb_WithoutParent, object pd_UserDefined1, object pd_UserDefined2, object ps_UserDefined3)
        {
            this.ib_CheckDetailMost = true;
            this.InitializeComponent();
            this.DataGridBrowser = this.grdBrowser;
            this.DataGridBrowser.AutoGenerateColumns = false;
            this.CheckDetailMost = pb_CheckDetailMost;
            this.UserDefined1 = pd_UserDefined1;
            this.UserDefined2 = pd_UserDefined2;
            this.UserDefined3 = ps_UserDefined3;
            if (!this.CheckDetailMost || pb_WithoutParent)
            {
                this.OnGenerateColumns();
                this.OnRefresh();
            }
        }

        private void btnAdd_Click(object sender, EventArgs e)
        {
            this.OnAdd();
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            base.Close();
        }

        private void btnDelete_Click(object sender, EventArgs e)
        {
            this.OnDelete();
        }

        private void btnDetail_Click(object sender, EventArgs e)
        {
            this.OnShowDetail();
        }

        private void btnEdit_Click(object sender, EventArgs e)
        {
            if (this.CheckDetailMost)
            {
                this.OnEdit();
            }
            else
            {
                this.OnShowDetail();
            }
        }

        private void btnFind_Click(object sender, EventArgs e)
        {
            this.OnFind();
        }

        private void btnPreview_Click(object sender, EventArgs e)
        {
            this.OnPrint(false);
        }

        private void btnPrint_Click(object sender, EventArgs e)
        {
            this.OnPrint(true);
        }

        private void btnRefresh_Click(object sender, EventArgs e)
        {
            this.OnRefresh();
        }

        private void btnSum_Click(object sender, EventArgs e)
        {
            this.OnSum();
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void grdBrowser_DoubleClick(object sender, EventArgs e)
        {
            if (this.CheckDetailMost)
            {
                this.OnEdit();
            }
            else
            {
                this.OnShowDetail();
            }
        }

        private void InitializeComponent()
        {
            this.Toolbars = new System.Windows.Forms.ToolStrip();
            this.btnRefresh = new System.Windows.Forms.ToolStripButton();
            this.tbrSep01 = new System.Windows.Forms.ToolStripSeparator();
            this.btnDetail = new System.Windows.Forms.ToolStripButton();
            this.tbrSep06 = new System.Windows.Forms.ToolStripSeparator();
            this.btnAdd = new System.Windows.Forms.ToolStripButton();
            this.btnEdit = new System.Windows.Forms.ToolStripButton();
            this.btnDelete = new System.Windows.Forms.ToolStripButton();
            this.tbrSep02 = new System.Windows.Forms.ToolStripSeparator();
            this.txtSearch = new SmartSoft.Controls.TbarSearch();
            this.tbrSep03 = new System.Windows.Forms.ToolStripSeparator();
            this.btnFind = new System.Windows.Forms.ToolStripButton();
            this.tbrSep04 = new System.Windows.Forms.ToolStripSeparator();
            this.btnSum = new System.Windows.Forms.ToolStripButton();
            this.tbrSep05 = new System.Windows.Forms.ToolStripSeparator();
            this.btnPreview = new System.Windows.Forms.ToolStripButton();
            this.btnPrint = new System.Windows.Forms.ToolStripButton();
            this.tbrSep07 = new System.Windows.Forms.ToolStripSeparator();
            this.btnClose = new System.Windows.Forms.ToolStripButton();
            this.grdBrowser = new SmartSoft.Controls.GridControl();
            this.Toolbars.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.grdBrowser)).BeginInit();
            this.SuspendLayout();
            // 
            // Toolbars
            // 
            this.Toolbars.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.btnRefresh,
            this.tbrSep01,
            this.btnDetail,
            this.tbrSep06,
            this.btnAdd,
            this.btnEdit,
            this.btnDelete,
            this.tbrSep02,
            this.txtSearch,
            this.tbrSep03,
            this.btnFind,
            this.tbrSep04,
            this.btnSum,
            this.tbrSep05,
            this.btnPreview,
            this.btnPrint,
            this.tbrSep07,
            this.btnClose});
            this.Toolbars.Location = new System.Drawing.Point(0, 0);
            this.Toolbars.Name = "Toolbars";
            this.Toolbars.Size = new System.Drawing.Size(794, 27);
            this.Toolbars.TabIndex = 0;
            this.Toolbars.Text = "Toolbars";
            // 
            // btnRefresh
            // 
            this.btnRefresh.Image = global::SmartSoft.Properties.Resources.REFRESH;
            this.btnRefresh.ImageTransparentColor = System.Drawing.Color.Magenta;
            this.btnRefresh.Name = "btnRefresh";
            this.btnRefresh.Size = new System.Drawing.Size(66, 24);
            this.btnRefresh.Text = "Refresh";
            this.btnRefresh.ToolTipText = "Refresh";
            this.btnRefresh.Click += new System.EventHandler(this.btnRefresh_Click);
            // 
            // tbrSep01
            // 
            this.tbrSep01.Name = "tbrSep01";
            this.tbrSep01.Size = new System.Drawing.Size(6, 27);
            // 
            // btnDetail
            // 
            this.btnDetail.Image = global::SmartSoft.Properties.Resources.DETAIL1;
            this.btnDetail.ImageTransparentColor = System.Drawing.Color.Magenta;
            this.btnDetail.Name = "btnDetail";
            this.btnDetail.Size = new System.Drawing.Size(65, 24);
            this.btnDetail.Text = "Chi tiết";
            this.btnDetail.ToolTipText = "Chi tiết (Enter)";
            this.btnDetail.Visible = false;
            this.btnDetail.Click += new System.EventHandler(this.btnDetail_Click);
            // 
            // tbrSep06
            // 
            this.tbrSep06.Name = "tbrSep06";
            this.tbrSep06.Size = new System.Drawing.Size(6, 27);
            this.tbrSep06.Visible = false;
            // 
            // btnAdd
            // 
            this.btnAdd.Image = global::SmartSoft.Properties.Resources.BALANCE1;
            this.btnAdd.ImageTransparentColor = System.Drawing.Color.Magenta;
            this.btnAdd.Name = "btnAdd";
            this.btnAdd.Size = new System.Drawing.Size(58, 24);
            this.btnAdd.Text = "Thêm";
            this.btnAdd.ToolTipText = "Thêm mới (F2)";
            this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
            // 
            // btnEdit
            // 
            this.btnEdit.Image = global::SmartSoft.Properties.Resources.EDIT1;
            this.btnEdit.ImageTransparentColor = System.Drawing.Color.Magenta;
            this.btnEdit.Name = "btnEdit";
            this.btnEdit.Size = new System.Drawing.Size(46, 24);
            this.btnEdit.Text = "Sửa";
            this.btnEdit.ToolTipText = "Sửa (F3)";
            this.btnEdit.Click += new System.EventHandler(this.btnEdit_Click);
            // 
            // btnDelete
            // 
            this.btnDelete.Image = global::SmartSoft.Properties.Resources.DELETE1;
            this.btnDelete.ImageTransparentColor = System.Drawing.Color.Magenta;
            this.btnDelete.Name = "btnDelete";
            this.btnDelete.Size = new System.Drawing.Size(47, 24);
            this.btnDelete.Text = "Xóa";
            this.btnDelete.ToolTipText = "Xoá (F8)";
            this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click);
            // 
            // tbrSep02
            // 
            this.tbrSep02.Name = "tbrSep02";
            this.tbrSep02.Size = new System.Drawing.Size(6, 27);
            // 
            // txtSearch
            // 
            this.txtSearch.Name = "txtSearch";
            this.txtSearch.Size = new System.Drawing.Size(100, 27);
            this.txtSearch.Text = "Tìm nhanh...";
            this.txtSearch.ToolTipText = "F4";
            // 
            // tbrSep03
            // 
            this.tbrSep03.Name = "tbrSep03";
            this.tbrSep03.Size = new System.Drawing.Size(6, 27);
            // 
            // btnFind
            // 
            this.btnFind.Image = global::SmartSoft.Properties.Resources.FIND;
            this.btnFind.ImageTransparentColor = System.Drawing.Color.Magenta;
            this.btnFind.Name = "btnFind";
            this.btnFind.Size = new System.Drawing.Size(77, 24);
            this.btnFind.Text = "Tìm kiếm";
            this.btnFind.ToolTipText = "Tìm kiếm";
            this.btnFind.Click += new System.EventHandler(this.btnFind_Click);
            // 
            // tbrSep04
            // 
            this.tbrSep04.Name = "tbrSep04";
            this.tbrSep04.Size = new System.Drawing.Size(6, 27);
            // 
            // btnSum
            // 
            this.btnSum.Image = global::SmartSoft.Properties.Resources.SUM;
            this.btnSum.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
            this.btnSum.ImageTransparentColor = System.Drawing.Color.Magenta;
            this.btnSum.Name = "btnSum";
            this.btnSum.Size = new System.Drawing.Size(59, 24);
            this.btnSum.Text = "Tổng";
            this.btnSum.ToolTipText = "Tổng cộng";
            this.btnSum.Click += new System.EventHandler(this.btnSum_Click);
            // 
            // tbrSep05
            // 
            this.tbrSep05.Name = "tbrSep05";
            this.tbrSep05.Size = new System.Drawing.Size(6, 27);
            // 
            // btnPreview
            // 
            this.btnPreview.Image = global::SmartSoft.Properties.Resources.PREVIEW1;
            this.btnPreview.ImageTransparentColor = System.Drawing.Color.Magenta;
            this.btnPreview.Name = "btnPreview";
            this.btnPreview.Size = new System.Drawing.Size(51, 24);
            this.btnPreview.Text = "Xem";
            this.btnPreview.ToolTipText = "Xem trước khi in (Ctrl+F7)";
            this.btnPreview.Click += new System.EventHandler(this.btnPreview_Click);
            // 
            // btnPrint
            // 
            this.btnPrint.Image = global::SmartSoft.Properties.Resources.PRINT11;
            this.btnPrint.ImageTransparentColor = System.Drawing.Color.Magenta;
            this.btnPrint.Name = "btnPrint";
            this.btnPrint.Size = new System.Drawing.Size(37, 24);
            this.btnPrint.Text = "In";
            this.btnPrint.ToolTipText = "In (F7)";
            this.btnPrint.Click += new System.EventHandler(this.btnPrint_Click);
            // 
            // tbrSep07
            // 
            this.tbrSep07.Name = "tbrSep07";
            this.tbrSep07.Size = new System.Drawing.Size(6, 27);
            // 
            // btnClose
            // 
            this.btnClose.Image = global::SmartSoft.Properties.Resources.CLOSE;
            this.btnClose.ImageTransparentColor = System.Drawing.Color.Magenta;
            this.btnClose.Name = "btnClose";
            this.btnClose.Size = new System.Drawing.Size(58, 24);
            this.btnClose.Text = "Thoát";
            this.btnClose.ToolTipText = "Thoát (Esc)";
            this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
            // 
            // grdBrowser
            // 
            this.grdBrowser.AllowUserToAddRows = false;
            this.grdBrowser.AllowUserToDeleteRows = false;
            this.grdBrowser.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.DisplayedCells;
            this.grdBrowser.CheckColor = false;
            this.grdBrowser.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.grdBrowser.Dock = System.Windows.Forms.DockStyle.Fill;
            this.grdBrowser.Font = new System.Drawing.Font("Arial", 8.25F);
            this.grdBrowser.Location = new System.Drawing.Point(0, 27);
            this.grdBrowser.Name = "grdBrowser";
            this.grdBrowser.ReadOnly = true;
            this.grdBrowser.Size = new System.Drawing.Size(794, 512);
            this.grdBrowser.TabIndex = 1;
            this.grdBrowser.DoubleClick += new System.EventHandler(this.grdBrowser_DoubleClick);
            // 
            // FormOpenningLister
            // 
            this.ClientSize = new System.Drawing.Size(794, 539);
            this.Controls.Add(this.grdBrowser);
            this.Controls.Add(this.Toolbars);
            this.MinimumSize = new System.Drawing.Size(802, 566);
            this.Name = "FormOpenningLister";
            this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
            this.Toolbars.ResumeLayout(false);
            this.Toolbars.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this.grdBrowser)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        protected virtual void OnAdd()
        {
            if (this.LocalFormEditor != null)
            {
                this.LocalFormEditor.LocalFormLister = this;
                this.LocalFormEditor.NewChecked = true;
                this.LocalFormEditor.LocalTable = this.LocalTable;
                this.LocalFormEditor.LocalCurrentRow = this.LocalCurrentRow;
                this.LocalFormEditor.Show();
            }
        }

        protected virtual void OnDelete()
        {
        }

        protected virtual void OnEdit()
        {
            if (((this.LocalTable != null) && (this.LocalTable.Rows.Count != 0)) && (this.LocalFormEditor != null))
            {
                this.LocalFormEditor.LocalFormLister = this;
                this.LocalFormEditor.NewChecked = false;
                this.LocalFormEditor.LocalTable = this.LocalTable;
                this.LocalFormEditor.LocalCurrentRow = this.LocalCurrentRow;
                this.LocalFormEditor.Show();
            }
        }

        protected virtual void OnFind()
        {
        }

        protected virtual void OnGenerateColumns()
        {
            if ((this.LocalColNames != null) && (this.LocalColNames.GetLength(0) != 0))
            {
                this.DataGridBrowser.Columns.Clear();
                for (int i = 0; i < this.LocalColNames.GetLength(0); i++)
                {
                    if (((string) this.LocalColNames[i][2]) == "C")
                    {
                        DataGridViewTextBoxColumn dataGridViewColumn = new DataGridViewTextBoxColumn();
                        dataGridViewColumn.DataPropertyName = (string) this.LocalColNames[i][0];
                        dataGridViewColumn.HeaderText = (string) this.LocalColNames[i][1];
                        dataGridViewColumn.HeaderCell = new HeaderControl(dataGridViewColumn.HeaderCell);
                        this.DataGridBrowser.Columns.Add(dataGridViewColumn);
                    }
                    else if (((string) this.LocalColNames[i][2]) == "D")
                    {
                        DataGridViewTextBoxColumn column2 = new DataGridViewTextBoxColumn();
                        column2.DataPropertyName = (string) this.LocalColNames[i][0];
                        column2.HeaderText = (string) this.LocalColNames[i][1];
                        column2.HeaderCell = new HeaderControl(column2.HeaderCell);
                        this.DataGridBrowser.Columns.Add(column2);
                    }
                    else if (((string) this.LocalColNames[i][2]) == "N")
                    {
                        NumericColumn column3 = new NumericColumn();
                        column3.DataPropertyName = (string) this.LocalColNames[i][0];
                        column3.HeaderText = (string) this.LocalColNames[i][1];
                        column3.ZeroIsShown = false;
                        if (this.LocalColNames[i][3] != null)
                        {
                            column3.UserTextNumericFormat = (AppInstance.TextNumericFormat) this.LocalColNames[i][3];
                        }
                        else
                        {
                            column3.NumericPrecision = 10;
                            column3.NumericScaleOnFocus = 2;
                            column3.NumericScaleOnLostFocus = 2;
                        }
                        column3.HeaderCell = new HeaderControl(column3.HeaderCell);
                        this.DataGridBrowser.Columns.Add(column3);
                    }
                }
            }
        }

        protected virtual void OnPrint(bool pb_Printed)
        {
        }

        protected virtual void OnRefresh()
        {
        }

        [Browsable(false)]
        public void OnSetPosition(string ps_FieldName, object ps_SearchedText)
        {
            if (this.LocalTable != null)
            {
                int num = 0;
                BindingSource dataSource = this.DataGridBrowser.DataSource as BindingSource;
                num = dataSource.Find(ps_FieldName, ps_SearchedText);
                if (num >= 0)
                {
                    if (num == 0)
                    {
                        dataSource.Position = dataSource.Count - 1;
                        dataSource.Position = num;
                    }
                    else
                    {
                        dataSource.Position = num;
                    }
                }
            }
        }

        protected virtual void OnShowDetail()
        {
            this.LocalChildForm.LocalParentForm = this;
            this.LocalChildForm.LocalParentRow = this.LocalCurrentRow;
            this.LocalChildForm.Show();
        }

        protected virtual void OnSum()
        {
            if (((base.ActiveGridBrowser != null) || (base.ActiveGridBrowser.CurrentCell != null)) && ((((base.ActiveGridBrowser.SelectedCells.Count != 1) || (base.ActiveGridBrowser.CurrentCell.ValueType.ToString() == "System.Decimal")) || ((base.ActiveGridBrowser.CurrentCell.ValueType.ToString() == "System.Int") || (base.ActiveGridBrowser.CurrentCell.ValueType.ToString() == "System.Int16"))) || (((base.ActiveGridBrowser.CurrentCell.ValueType.ToString() == "System.Int32") || (base.ActiveGridBrowser.CurrentCell.ValueType.ToString() == "System.Int64")) || (base.ActiveGridBrowser.CurrentCell.ValueType.ToString() == "System.Int16"))))
            {
                decimal num = 0M;
                int numericScaleOnFocus = 0;
                if (base.ActiveGridBrowser.Columns[base.ActiveGridBrowser.CurrentCell.ColumnIndex] is NumericColumn)
                {
                    numericScaleOnFocus = (base.ActiveGridBrowser.Columns[base.ActiveGridBrowser.CurrentCell.ColumnIndex] as NumericColumn).NumericScaleOnFocus;
                }
                if (base.ActiveGridBrowser.SelectedCells.Count == 1)
                {
                    for (int i = 0; i < base.ActiveGridBrowser.Rows.Count; i++)
                    {
                        DataGridViewCell cell = base.ActiveGridBrowser[base.ActiveGridBrowser.CurrentCell.ColumnIndex, i];
                        if (!cell.Value.Equals(DBNull.Value) && !cell.Value.Equals(SDBNull.Value))
                        {
                            num += (decimal) cell.Value;
                        }
                    }
                }
                else
                {
                    foreach (DataGridViewCell cell2 in base.ActiveGridBrowser.SelectedCells)
                    {
                        if (!cell2.Value.Equals(DBNull.Value) && !cell2.Value.Equals(SDBNull.Value) && ((((cell2.ValueType.ToString() == "System.Decimal") || (cell2.ValueType.ToString() == "System.Int")) || ((cell2.ValueType.ToString() == "System.Int16") || (cell2.ValueType.ToString() == "System.Int32"))) || ((cell2.ValueType.ToString() == "System.Int64") || (cell2.ValueType.ToString() == "System.Int16"))))
                        {
                            num += (decimal) cell2.Value;
                        }
                    }
                }
                MessageBox.Show("Tổng cộng: " + num.ToString("N" + numericScaleOnFocus.ToString()), AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }

        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            if ((keyData == (Keys.Control | Keys.Return)) && this.btnRefresh.Enabled)
            {
                this.OnRefresh();
                return true;
            }
            if (keyData == Keys.F4)
            {
                this.txtSearch.Focus();
                return true;
            }
            if ((keyData == Keys.F2) && this.btnAdd.Enabled)
            {
                if (this.CheckDetailMost)
                {
                    this.OnAdd();
                }
                else
                {
                    this.OnShowDetail();
                }
                return true;
            }
            if ((keyData == Keys.F3) && this.btnEdit.Enabled)
            {
                if (this.CheckDetailMost)
                {
                    this.OnEdit();
                }
                else
                {
                    this.OnShowDetail();
                }
                return true;
            }
            if ((keyData == Keys.F8) && this.btnDelete.Enabled)
            {
                if (this.CheckDetailMost)
                {
                    this.OnDelete();
                }
                else
                {
                    this.OnShowDetail();
                }
                return true;
            }
            if ((keyData == Keys.Return) && !this.CheckDetailMost)
            {
                this.OnShowDetail();
                return true;
            }
            if ((keyData == (Keys.Control | Keys.F)) && this.btnFind.Enabled)
            {
                this.OnFind();
                return true;
            }
            if ((keyData == Keys.F7) && this.btnPrint.Enabled)
            {
                this.OnPrint(true);
                return true;
            }
            if ((keyData == (Keys.Control | Keys.F7)) && this.btnPreview.Enabled)
            {
                this.OnPrint(false);
                return true;
            }
            if (keyData == Keys.Escape)
            {
                base.Close();
                return true;
            }
            return base.ProcessCmdKey(ref msg, keyData);
        }

        [DefaultValue(true), Browsable(false)]
        private bool CheckDetailMost
        {
            get
            {
                return this.ib_CheckDetailMost;
            }
            set
            {
                if (this.ib_CheckDetailMost != value)
                {
                    this.ib_CheckDetailMost = value;
                    this.btnDetail.Visible = !this.ib_CheckDetailMost;
                    this.tbrSep06.Visible = !this.ib_CheckDetailMost;
                    this.btnAdd.Visible = this.ib_CheckDetailMost;
                    this.btnEdit.Visible = this.ib_CheckDetailMost;
                    this.btnDelete.Visible = this.ib_CheckDetailMost;
                    this.tbrSep02.Visible = this.ib_CheckDetailMost;
                }
            }
        }

        public GridControl DataGridBrowser
        {
            get
            {
                return this.oGridBrowser;
            }
            set
            {
                if (this.oGridBrowser != value)
                {
                    this.oGridBrowser = value;
                }
            }
        }

        public FormOpenningLister LocalChildForm
        {
            get
            {
                return this.oLocalChildForm;
            }
            set
            {
                this.oLocalChildForm = value;
            }
        }

        [Browsable(false)]
        public object[][] LocalColNames
        {
            get
            {
                return this.is_LocalColNames;
            }
            set
            {
                this.is_LocalColNames = value;
            }
        }

        public DataRow LocalCurrentRow
        {
            get
            {
                if (((this.DataGridBrowser.Rows.Count != 0) && (this.DataGridBrowser.CurrentRow != null)) && (this.DataGridBrowser.CurrentRow.DataBoundItem != null))
                {
                    return ((DataRowView) this.DataGridBrowser.CurrentRow.DataBoundItem).Row;
                }
                return null;
            }
        }

        [Browsable(false), Category("Browser properties")]
        public FormOpenningEditor LocalFormEditor
        {
            get
            {
                return this.oFormEditor;
            }
            set
            {
                this.oFormEditor = value;
            }
        }

        public FormOpenningLister LocalParentForm
        {
            get
            {
                return this.oLocalParentForm;
            }
            set
            {
                this.oLocalParentForm = value;
            }
        }

        public DataRow LocalParentRow
        {
            get
            {
                return this.oLocalParentRow;
            }
            set
            {
                this.oLocalParentRow = value;
                if (this.CheckDetailMost)
                {
                    this.OnGenerateColumns();
                    this.OnRefresh();
                }
            }
        }

        public DataTable LocalTable
        {
            get
            {
                return this.oLocalTable;
            }
            set
            {
                if (this.oLocalTable != value)
                {
                    this.oLocalTable = value;
                    this.DataGridBrowser.DataSource = new BindingSource(this.LocalTable, this.LocalTable.TableName);
                }
            }
        }

        public object UserDefined1
        {
            get
            {
                return this.oUserDefined1;
            }
            set
            {
                this.oUserDefined1 = value;
            }
        }

        public object UserDefined2
        {
            get
            {
                return this.oUserDefined2;
            }
            set
            {
                this.oUserDefined2 = value;
            }
        }

        public object UserDefined3
        {
            get
            {
                return this.oUserDefined3;
            }
            set
            {
                this.oUserDefined3 = value;
            }
        }
    }
}

